import { Component, OnInit } from '@angular/core';
import { NzMessageService, UploadFile } from 'ng-zorro-antd';
import { ApiService } from 'src/app/core/api';
import { MessageService } from 'src/app/core/service/message.service';
import { FormBuilder, Validators } from '@angular/forms';
import { urlService } from './../../../core/api/url';
import { Router, ActivatedRoute } from '@angular/router';
import { DatePipe } from '@angular/common';
import { I18nService } from 'src/app/core/i18n/i18n.service';

@Component({
	templateUrl: './guideDetail.html',
	providers: [DatePipe],
})
export class GuideDetailComponent implements OnInit {
	data: any = {
		"name":"","agencyName":"","agencyId":1,"mobile":"","birthday":"","reservationFee":null,"sunOpenTime":null,"sunCloseTime":null,"monOpenTime":"","monCloseTime":"","tueOpenTime":"","tueCloseTime":"",
		"wedOpenTime":"","wedCloseTime":"","thuOpenTime":"","thuCloseTime":"","friOpenTime":"","friCloseTime":"","satOpenTime":null,"satCloseTime":null,
		"personalityTagList":[],"brief":"","images":""
	};
	week;
	id;
	constructor(private i18n:I18nService ,private apiService: ApiService, private nzMessageService: NzMessageService, private message: MessageService, private fb: FormBuilder, private router: Router, private datePipe: DatePipe, private activeRouter: ActivatedRoute) {
		this.id = this.activeRouter.snapshot.queryParams['id'];
		this.i18n.get('week').subscribe(res=>{
			this.week = res;
		})
	}
	ngOnInit() {
		this.message.setBreadcrumb({
			breadcrumbs: [{ name: '导游管理' }],
		});
		this.data.images = this.data.images.split(',');
		console.log(this.data.images);
		if (this.id) {
			this.apiService.post('导游详情', { id: this.id }).then((res: any) => {
				this.data = res.data.travelGuideDetail;
				this.data.images = this.data.images.split(',');
				console.log(this.data.images);
			});
		}
	}
}
